package com.ittx.dzt.weidian.service;

import com.ittx.dzt.edi.dto.FlagMemoDTO;
import com.ittx.dzt.edi.dto.PlatformApiParamDTO;
import com.ittx.dzt.edi.dto.StoreConfigDTO;
import com.ittx.dzt.sys.response.Result;
import com.ittx.dzt.weidian.handler.AbstractBaseWeidianApiHandler;
import lombok.extern.slf4j.Slf4j;
import open.constant.PlatformApiConstant;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;


/**
 * 订单备注
 * <p>
 * cy.shipment.flagUpdate
 * 修改订单备注(vdian.order.note.modify)
 * https://open.weidian.com/#/api/109
 * </p>
 *
 * @author wl_code@163.com
 * @version 1.0
 * @date 2025/4/1
 */
@Slf4j
@Service
public class WeidianOrderAddRemarkService extends AbstractBaseWeidianApiHandler<FlagMemoDTO> {
	@Override
	public String getLocalApiMethod() {
		return PlatformApiConstant.InboundInterface.FLAG_MEMO_UPDATE;
	}

	@Override
	public Result<?> doProcess(PlatformApiParamDTO platformApiParamDTO, FlagMemoDTO dto) {
		StoreConfigDTO storeConfig = platformApiParamDTO.getStoreConfig();
		Map<String, Object> params = new HashMap<>();
		params.put("order_id", dto.getSourceOrderCode());
		params.put("note", dto.getMemo());
		return this.executeWeidianApi(storeConfig, params, platformApiParamDTO.getRequestId());
	}


	@Override
	public String getWeidianMethod() {
		return "vdian.order.note.modify";
	}

	@Override
	public String getWeidianApiVersion() {
		return "1.0";
	}

	@Override
	public String getWeidianApiFormat() {
		return null;
	}
}
